import { useAxios } from '@/hooks/web/useAxios'
const request = useAxios()
import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 饲料出入库列表
export const spForageInOutOrderListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutOrderList',
      data: data
    }
  })
}

// 饲料出入库查看
export const spForageInOutOrderSeeApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutOrderSee',
      data: data
    }
  })
}
// 饲料出入库主表修改
export const spForageInOutOrderEditApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutOrderEdit',
      data: data
    }
  })
}

// 饲料出入库删除
export const spForageInOutOrderDelApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutOrderDel',
      data: data
    }
  })
}

// 饲料出入库归档
export const spForageInOutOrderEndApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutOrderEnd',
      data: data
    }
  })
}

// 饲料出入库查看
export const spForageInOutOrderAddAdminApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutOrderAddAdmin',
      data: data
    }
  })
}

// 饲料出入库明细添加
export const spForageInOutDetailedAddAdminApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutDetailedAddAdmin',
      data: data
    }
  })
}

// 饲料出入库明细删除
export const spForageInOutDetailedDelApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutDetailedDel',
      data: data
    }
  })
}

// 饲料档案列表
export const spForageListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageList',
      data: data
    }
  })
}

// 饲料档案列表
export const spForageSpecsListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageSpecsList',
      data: data
    }
  })
}

// RFID列表
export const spForageInOutRfidListApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutRfidList',
      data: data
    }
  })
}

// RFID删除
export const spForageInOutRfidBatchDelApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutRfidBatchDel',
      data: data
    }
  })
}

// RFID删除
export const spForageInOutRfidBatchAddApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutRfidBatchAdd',
      data: data
    }
  })
}

// 采购领用人员
export const ucOrgUserListUserApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'ucOrgUserList',
      data: data
    }
  })
}

// 出入库实际数量修改
export const spForageInOutActualNumberEditApi = (data: any) => {
  return request.post({
    url: 'index.php/api/common',
    headers: { token: wsCache.get('token') },
    data: {
      code: 'spForageInOutActualNumberEdit',
      data: data
    }
  })
}

// excel文件
export const dbForageInOutOrderDetailedportApi = (data: any) => {
  return request.post({
    url: '/index.php/tools/excel/common',
    headers: { token: wsCache.get('token') },
    data: {
      api_code: 'dbForageInOutOrderDetailedList',
      request: data.request,
      layout_data: data.layout_data
    }
  })
}
